import React from "react";
import { RegisterCommand, withPropsAPI } from "gg-editor";

class AddCommand extends React.Component {
  state = { fullscreenClass: "" };

  render() {
    const { propsAPI } = this.props;

    const config = {
      // 是否进入列队，默认为 true
      queue: true,

      // 命令是否可用
      enable(/* editor */) {
        return true;
      },

      // 正向命令逻辑
      execute(/* editor */) {

      },

      // 反向命令逻辑
      back(/* editor */) {
        console.log("执行反向命令");
      },

      // 快捷按键配置
      shortcutCodes: [["metaKey", "n"], ["ctrlKey", "n"]]
    };


    return (
      <div>
        <RegisterCommand name="addCommand" config={config} />
      </div>
    );
  }
}

export default withPropsAPI(AddCommand);
